public class GetAge {
    public static void main(String[] args) {
        int year = 2012;
        int mon = 3;
        int day = 12;
        int sYear = 2012;
        int sMon = 6;
        while (true) {
            sYear --;
            for (int i = 1; i <= 30; i++) {
                int num = sYear * 10000 + sMon * 100 + i;
                if (num % year == 0 && num % mon == 0 && num % day == 0) {
                    System.out.println(num);
                    return;
                }
            }
        }
    }

    public static boolean isLeap(int year) {
        if (year % 4 == 0) {
            if (year % 100 != 0 || year % 400 == 0) {
                return true;
            }
        }
        return false;
    }
}
